{"ast":null,"code":"import React from'react';import Title from\"./utils/Title\";import{Context}from\"./index\";import{observer}from\"mobx-react-lite\";import{Route,Routes,useNavigate}from\"react-router-dom\";import{Auth,Home}from\"./pages\";import{browserRouteAuth,browserRouteHome}from\"./routes\";import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var App=function App(){var _React$useContext=React.useContext(Context),store=_React$useContext.store;var navigate=useNavigate();Title();React.useEffect(function(){if(localStorage.getItem(\"\".concat(process.env.REACT_APP_NAME_TOKEN))){store.checkAuth();}// eslint-disable-next-line react-hooks/exhaustive-deps\n},[]);React.useEffect(function(){store.getAuth()?navigate(browserRouteHome):navigate(browserRouteAuth);// eslint-disable-next-line react-hooks/exhaustive-deps\n},[store.getAuth()]);if(store.getLoading()){return/*#__PURE__*/_jsx(\"section\",{children:/*#__PURE__*/_jsx(\"div\",{children:\"\\u0417\\u0430\\u0433\\u0440\\u0443\\u0437\\u043A\\u0430...\"})});}return/*#__PURE__*/_jsxs(Routes,{children:[/*#__PURE__*/_jsx(Route,{path:browserRouteAuth,element:/*#__PURE__*/_jsx(Auth,{})}),/*#__PURE__*/_jsx(Route,{path:browserRouteHome,element:/*#__PURE__*/_jsx(Home,{})})]});};export default observer(App);","map":{"version":3,"names":["React","Title","Context","observer","Route","Routes","useNavigate","Auth","Home","browserRouteAuth","browserRouteHome","App","useContext","store","navigate","useEffect","localStorage","getItem","process","env","REACT_APP_NAME_TOKEN","checkAuth","getAuth","getLoading"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/App.tsx"],"sourcesContent":["import React, {FC} from 'react';\nimport Title from \"./utils/Title\";\nimport {Context} from \"./index\";\nimport {observer} from \"mobx-react-lite\";\nimport {Route, Routes, useNavigate} from \"react-router-dom\";\nimport {Auth, Home} from \"./pages\";\nimport {browserRouteAuth, browserRouteHome} from \"./routes\";\n\nconst App: FC = () => {\n    const {store} = React.useContext(Context);\n    const navigate = useNavigate();\n\n    Title();\n\n    React.useEffect( () => {\n        if (localStorage.getItem(`${process.env.REACT_APP_NAME_TOKEN}`)) {\n            store.checkAuth();\n        }\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, []);\n\n    React.useEffect( () => {\n        (store.getAuth())? navigate(browserRouteHome): navigate(browserRouteAuth);\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n    }, [store.getAuth()]);\n\n    if (store.getLoading()) {\n        return (\n            <section>\n                <div>Загрузка...</div>\n            </section>\n        )\n    }\n\n    return (\n      <Routes>\n          <Route path={browserRouteAuth} element={<Auth />} />\n          <Route path={browserRouteHome} element={<Home />} />\n      </Routes>\n    );\n}\n\nexport default observer(App);\n"],"mappings":"AAAA,MAAOA,MAAK,KAAY,OAAO,CAC/B,MAAOC,MAAK,KAAM,eAAe,CACjC,OAAQC,OAAO,KAAO,SAAS,CAC/B,OAAQC,QAAQ,KAAO,iBAAiB,CACxC,OAAQC,KAAK,CAAEC,MAAM,CAAEC,WAAW,KAAO,kBAAkB,CAC3D,OAAQC,IAAI,CAAEC,IAAI,KAAO,SAAS,CAClC,OAAQC,gBAAgB,CAAEC,gBAAgB,KAAO,UAAU,CAAC,wFAE5D,GAAMC,IAAO,CAAG,QAAVA,IAAO,EAAS,CAClB,sBAAgBX,KAAK,CAACY,UAAU,CAACV,OAAO,CAAC,CAAlCW,KAAK,mBAALA,KAAK,CACZ,GAAMC,SAAQ,CAAGR,WAAW,EAAE,CAE9BL,KAAK,EAAE,CAEPD,KAAK,CAACe,SAAS,CAAE,UAAM,CACnB,GAAIC,YAAY,CAACC,OAAO,WAAIC,OAAO,CAACC,GAAG,CAACC,oBAAoB,EAAG,CAAE,CAC7DP,KAAK,CAACQ,SAAS,EAAE,CACrB,CACA;AACJ,CAAC,CAAE,EAAE,CAAC,CAENrB,KAAK,CAACe,SAAS,CAAE,UAAM,CAClBF,KAAK,CAACS,OAAO,EAAE,CAAGR,QAAQ,CAACJ,gBAAgB,CAAC,CAAEI,QAAQ,CAACL,gBAAg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